package o;

import android.widget.SectionIndexer;
import java.util.Arrays;

public class fpw implements SectionIndexer {
    private int[] ˊ;
    private String[] ˏ;
    private int ॱ;

    public fpw(String[] strArr, int[] iArr, boolean z) {
        int i = 0;
        if (strArr != null && iArr != null && strArr.length == iArr.length) {
            int length = strArr.length;
            this.ˏ = new String[length];
            System.arraycopy(strArr, 0, this.ˏ, 0, length);
            this.ˊ = new int[length];
            int i2 = 0;
            while (i < length) {
                if (this.ˏ[i] == null) {
                    this.ˏ[i] = "";
                } else {
                    this.ˏ[i] = this.ˏ[i].trim();
                }
                this.ˊ[i] = i2;
                i2 += iArr[i];
                i++;
            }
            this.ॱ = i2;
        }
    }

    public fpw(String[] strArr, int[] iArr) {
        this(strArr, iArr, false);
    }

    public Object[] getSections() {
        if (this.ˏ == null || this.ˏ.length == 0) {
            return new String[0];
        }
        int length = this.ˏ.length;
        Object obj = new String[length];
        System.arraycopy(this.ˏ, 0, obj, 0, length);
        return obj;
    }

    public int getPositionForSection(int i) {
        if (i < 0 || i >= this.ˏ.length) {
            return -1;
        }
        return this.ˊ[i];
    }

    public int getSectionForPosition(int i) {
        if (i < 0 || i >= this.ॱ) {
            return -1;
        }
        int binarySearch = Arrays.binarySearch(this.ˊ, i);
        return binarySearch < 0 ? (-binarySearch) - 2 : binarySearch;
    }
}
